<?php

Route::get('/','Home\HomeController@index');


Route::auth();

$this->group(['namespace' => 'Account','prefix' => '/account', 'middleware' => ['auth']],function(){
    Route::get('', 'IndexController@index');
});





Route::get('admin', function () {
    return redirect('/admin/index/index');
});

$this->group(['namespace' => 'Admin','prefix' => '/admin'], function () {
    Route::get('login', 'Auth\AuthController@showLoginForm');
    Route::post('login', 'Auth\AuthController@login');
    Route::get('logout', 'Auth\AuthController@logout');
});

$router->group(['namespace' => 'Admin', 'middleware' => ['authAdmin:admin','menu']], function () {
    //后台首页
    Route::get('admin/admin/index', ['as' => 'admin.admin.index', 'uses'=>'IndexController@index']);
    Route::get('admin/index/index', ['as' => 'admin.index.index', 'uses'=>'IndexController@index']);
    //权限管理路由
    Route::get('admin/permission/index', ['as' => 'admin.permission.index', 'uses' => 'PermissionController@index']); //查询
    Route::post('admin/permission/index', ['as' => 'admin.permission.index', 'uses' => 'PermissionController@index']); //查询
    Route::get('admin/permission/{cid}/create', ['as' => 'admin.permission.create', 'uses' => 'PermissionController@create']);
    Route::post('admin/permission/create', ['as' => 'admin.permission.create', 'uses' => 'PermissionController@store']); //添加
    Route::get('admin/permission/{cid?}', ['as' => 'admin.permission.index', 'uses' => 'PermissionController@index']);
    Route::get('admin/permission/{permission}/edit ', ['as' => 'admin.permission.edit', 'uses' => 'PermissionController@edit']);
    Route::put('admin/permission/edit', ['as' => 'admin.permission.edit', 'uses' => 'PermissionController@update']); //修改保存
    Route::delete('admin/permission/{permission}', ['as' => 'admin.permission.destroy', 'uses' => 'PermissionController@destroy']);//删除

    //角色管理路由
    Route::get('admin/role/index', ['as' => 'admin.role.index', 'uses' => 'RoleController@index']);
    Route::post('admin/role/index', ['as' => 'admin.role.index', 'uses' => 'RoleController@index']);
    Route::get('admin/role/{role}/edit', ['as' => 'admin.role.edit', 'uses' => 'RoleController@edit']);
    Route::put('admin/role/edit', ['as' => 'admin.role.edit', 'uses' => 'RoleController@update']); //修改保存
    Route::get('admin/role/create', ['as' => 'admin.role.create', 'uses' => 'RoleController@create']); //添加
    Route::post('admin/role/store', ['as' => 'admin.role.create', 'uses' => 'RoleController@store']); //添加保存
    Route::delete('admin/role/{role}', ['as' => 'admin.role.destroy', 'uses' => 'RoleController@destroy']);//删除

    //用户管理路由
    Route::get('admin/user/manage', ['as' => 'admin.user.manage', 'uses' => 'UserController@index']);  //用户管理
    Route::post('admin/user/index', ['as' => 'admin.user.index', 'uses' => 'UserController@index']);
    Route::get('admin/user/index', ['as' => 'admin.user.index', 'uses' => 'UserController@index']);
    Route::get('admin/user/{user}/edit', ['as' => 'admin.user.edit', 'uses' => 'UserController@edit']); //修改
    Route::put('admin/user/edit', ['as' => 'admin.user.edit', 'uses' => 'UserController@update']); //修改保存
    Route::get('admin/user/create', ['as' => 'admin.user.create', 'uses' => 'UserController@create']); //添加
    Route::post('admin/user/store', ['as' => 'admin.user.create', 'uses' => 'UserController@store']); //添加保存
    Route::delete('admin/user/{user}', ['as' => 'admin.user.destroy', 'uses' => 'UserController@destroy']);//删除

    //内容管理
    Route::get('admin/post/manage', ['as' => 'admin.post.manage', 'uses' => 'PostController@index']);
    //文章管理
    Route::post('admin/post/index', ['as' => 'admin.post.index', 'uses' => 'PostController@index']);
    //分类管理
    Route::post('admin/category/index', ['as' => 'admin.category.index', 'uses' => 'CategoryController@index']);
    //模型管理
    Route::post('admin/model/index', ['as' => 'admin.model.index', 'uses' => 'ModelController@index']);
    //版本管理
    Route::post('admin/version/index', ['as' => 'admin.version.index', 'uses' => 'ModelController@index']);


});







